import random

def sort(list):
    lo=0
    hi=len(list)-1
    while(lo<hi):
        hi=bubble(lo,hi,list)
    return list
        
def bubble(lo,hi,list):
    #print('调用了一次')
    last=lo
    while(lo<hi):
        lo=lo+1
        if list[lo]<list[lo-1]:
            last=lo
            tmp=list[lo-1]
            list[lo-1]=list[lo]
            list[lo]=tmp
    return last

if __name__ == "__main__":
    # testArray=[]
    # while len(testArray)<20:
    #     testArray.append(random.randint(0,100))
    # print("最终结果==",sort(testArray))
    testArray2= [1, 23, 24, 91, 99, 37, 41, 47, 47, 54, 55, 57, 58, 61, 67, 69, 71, 77, 78, 91]
    print("最终结果==",sort(testArray2))